<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        table {
            border-right: 1px solid #000000;
            border-bottom: 1px solid #000000;
            text-align: center;
        }

        table th {
            border-left: 1px solid #000000;
            border-top: 1px solid #000000;
        }

        table td {
            border-left: 1px solid #000000;
            border-top: 1px solid #000000;
        }
    </style>
</head>
<body>
<h2>数据库中的数据</h2>
<table style="width: 800px; height: 80px;">
    <tr>
        <th>序号</th>
        <th>书名</th>
        <th>作者</th>
        <th>出版社</th>
        <th>价格</th>
        <th>市场价格</th>
        <th>操作</th>
    </tr>
    {% for book in books %}
    <tr>
        <td>{{book.id}}</td>
        <td>{{book.title}}</td>
        <td>{{book.authors.name}}</td>
        <td>{{book.pub}}</td>
        <td>{{book.price}}</td>
        <td>{{book.market_price}}</td>
        <td>
            <a href="/bookstore/update_book/{{book.id}}">修改</a>
<!--            <a href="/bookstore/delete_book/{{book.id}}">删除</a>-->
            <a href="/bookstore/delete_book?book_id={{book.id}}">删除</a>
        </td>
    </tr>
    {% endfor %}
</table>
<br>
<br>
<h2>录入数据</h2>
<form  method="post">
    <input type="text" name="title" value="请输入书名">
    <input type="text" name="author_name" value="请输入作者">
    <input type="text" name="author_age" value="请输入作者年龄">
    <input type="text" name="author_gender" value="请输入作者性别">

    <input type="text" name="pub" value="请输入出版社">
    <input type="text" name="price" value="请输入价格">
    <input type="text" name="market_price" value="请输入书市场价格">

    <button type="submit">提交</button>

</form>

<br>
<br>
<h2>作者书籍表</h2>
<table style="width: 800px; height: 80px;">
    <tr>
        <th>序号</th>
        <th>姓名</th>
        <th>年龄</th>
        <th>性别</th>
        <th>书籍</th>
    </tr>
    {% for author in authors %}
    <tr>
        <td>{{author.id}}</td>
        <td>{{author.name}}</td>
        <td>{{author.age}}</td>
        <td>{{author.gender}}</td>
        <td>{{author.books}}</td>
    </tr>
    {% endfor %}
</table>
</body>
</html>